{% load i18n %}   
  {% if user.groups.all.0|stringformat:'s' == "administrator" %}
    <nav class="main-header navbar navbar-expand navbar-orange navbar-light">
  {% else %}
    <nav class="main-header navbar navbar-expand navbar-green navbar-light">
  {% endif %}

    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <ul class="navbar-nav ml-auto">

      <li class="nav-item">

      {% get_current_language as CURRENT_LANGUAGE %}
      {% get_available_languages as AVAILABLE_LANGUAGES %}
      {% get_language_info_list for AVAILABLE_LANGUAGES as languages %}

      <a class="nav-link" data-toggle="dropdown" href="#" aria-expanded="false">
      <i class="fa fa-flag"></i>
      {% translate "Language" %}
      </a>
      <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right" style="left: inherit; right: 0px;">

      <span class="dropdown-item dropdown-header">{% translate "Current Language" %} {{ CURRENT_LANGUAGE }}</span>

      {% for language in languages %}
        <form action="{% url 'set_language' %}" method="post">{% csrf_token %}
          <div class="dropdown-divider"></div>
          <button type="Submit"  class="dropdown-item" value="{{ language.code }}" name="language">

          <i class="fa fa-flag"></i> {{ language.name_translated }}
          
          {% if language.code == CURRENT_LANGUAGE %} 
              <span class="float-right text-muted text-sm"><b>{{ language.code }}</b></span>
          {% else %}
              <span class="float-right text-muted text-sm">{{ language.code }}</span>
          {% endif %}
          </a>
        </form>
      {% endfor %}
      </li>

      <li class="nav-item">
        <form id="logout-form" method="post" action="{% url 'logout' %}">
          {% csrf_token %}
          <a class="nav-link" role="button" href="#" onclick="document.getElementById('logout-form').submit(); return false;">
            <i class="fas fa-sign-out-alt"></i> {% translate "Logout" %} {{ request.user }} {% translate "session" %}
          </a>
        </form>
      </li>
  
    </ul>

  </nav>